package com.cloudOffice.storage;

/**
 * @program: cloud-office
 * @className: CommonIdStorage
 * @description: 存储用户id
 * @data: 2024/2/5 20:22
 * @author: ihu
 * @version: 1.0
 **/

public class CommonStorage {
	
	private static final ThreadLocal<Object> threadLocalId = new ThreadLocal<>();
	private static final ThreadLocal<String> threadLocalUsername = new ThreadLocal<>();
	
	public static Object getId() {
		return threadLocalId.get();
	}
	
	public static void setId(Object id) {
		threadLocalId.set(id);
	}
	
	public static void removeId() {
		threadLocalId.remove();
	}
	
	
	public static String getUsername() {return threadLocalUsername.get();}
	
	public static void setUsername(String username) {threadLocalUsername.set(username);}
	
	public static void removeUsername() {threadLocalUsername.remove();}
	
}
